package piece1.chapter5;

public class Problem5_01 {

    /**
     * @param args
     */
    public static void main(String[] args) {
	// TODO 自动生成的方法存根
	int a[] = new int[1000];
	for (int i = 0; i < a.length; i++) {
	    a[i] = (int) (Math.random() * 999 + 1);

	}

	int sum = 0, average;
	for (int i : a) {
	    sum += i;
	}
	average = sum / a.length;
	System.out.println("均值为:" + average);
	int count = 0;

	for (int j = 0; j < a.length; j++) {
	    if (a[j] > average) {
		System.out.println("a[" + j + "] " + a[j] + "大于均值.");
		count++;
	    } else {

	    }

	}

	System.out.println("共有" + count + "个值大于均值");
    }
}
